/*Declaring needed libraries for that task*/
import java.util.Scanner;
import java.util.Arrays;
import java.lang.String;

public class Anagramma
{
	public static void main(String[] args)
	{
		/*Creating Scanner and reading inout data from the user:*/
		Scanner input = new Scanner(System.in);

		System.out.print("Please enter the first string: ");

		/*making lower case string in order to avoid misbehavior of the program with the capital letters.*/
		String string_1 = input.next().toLowerCase();
		/*converting string to char array in order to make it easier to sort it and compare with the second one*/
		char[] str1 = string_1.toCharArray();

		System.out.print("Please enter the second string: ");
		/*making lower case string in order to avoid misbehavior of the program with the capital letters.*/
		String string_2 = input.next().toLowerCase();
		/*converting string to char array in order to make it easier to sort it and compare with the first one*/
		char[] str2 = string_2.toCharArray();

		/*Checking if two char arrays have the same length. If no then there is no reason to continue any cheks.*/
		if (str1.length != str2.length)
			System.out.println("These strings can't be the anagrams of each other. Sorry. :)");
		else
		/*If they have the same size/length then I sort them and compare each element of the same position between arrays
		If at least one is different then they can't be Anagram of each other.*/
		{
			Arrays.sort(str1);
			Arrays.sort(str2);
			for (int i=0; i<=(str1.length-1); i++)
			{
				if (str1[i]!=str2[i])
				{
					System.out.println("Sorry. They are not anagrams of each other. :( ");
					System.exit(1);
				}
			}
			System.out.println("Yeap. These strings are angrams of each other. Congratulation. :) ");
		}
	}
}